
<?php echo $this->Form->create('Cart',array('url'=>array('action'=>'update')));?>
<div id="breadcrumbs">
    <ol class="breadcrumb">
        <li><?php echo $this->Html->link("Trang chủ", array('controller' => 'mobiledetails','action' => 'index_view')) ?></li>
        <li>Giỏ hàng</li>
    </ol>
</div>
<div class="container">
    <h2>Giỏ hàng</h2>
<div class="row">
	<div class="col-lg-12   ">
		<table class="table">
			<thead>
				<tr>
                    <th>Image</th>
					<th>Product Name</th>
					<th>Price</th>
					<th>Quantity</th>
					<th>Total</th>
				</tr>
			</thead>
			<tbody>
				<?php $total=0;?>
				<?php foreach ($products as $product):?>
                    <tr>
                        <td style="width: 60px">
                            <?php echo $this->Html->image($product['Modell']['image_url'],array('fullBase' => true)); ?>
                        </td>
                        <td>
                            <?php echo $product['Modell']['mobile_name'];?>
                        </td>
                        <td>$<?php echo $price=$product['Modell']['price']*(1-$product['Modell']['discount']);?>
                        </td>
                        <td><div class="col-xs-3">
                                <?php echo $this->Form->hidden('product_id.',array('value'=>$product['MobileDetail']['id']));?>
                                <?php echo $this->Form->input('count.',array('type'=>'number', 'label'=>false,
                                    'class'=>'form-control input-sm', 'value'=>$product['Product']['count']));?>
                            </div></td>
                        <td>$<?php echo $sub =$product['Product']['count']*$price; ?>
                        </td>
                    </tr>
                    <?php $total = $total + $sub;?>
				<?php endforeach;?>

				<tr class="success">
					<td colspan=4></td>
					<td>$<?php echo $total;?>
					</td>
				</tr>
			</tbody>
		</table>

        <?php echo $this->Form->button('Update',array('class'=>'btn btn-warning','div'=>false));?>
        <?php echo $this->Form->end();?>

        <a class="btn btn-primary"
         <?php  echo $this->Html->Link("Continue order", array('controller' => 'indexpage','action'=> 'view_products'), array( 'class' => 'btn btn-success','div'=>false)) ?>
        <p class="text-right">
            <?php echo $this->Form->create('Cart',array('id'=>'add-form','url'=>array('controller'=>'carts','action'=>'clear_cart')));?>
            <?php echo $this->Form->button('Clear Cart',array('class'=>'btn btn-success'));?>

            <?php echo $this->Form->end();?>
            <?php echo $this->Html->Link("Check out",array('controller'=>'IndexPage','action'=>'add_info_customer'),array('class'=>'btn btn-primary'));?>
        </p>
    </div>

</div>

